<!DOCTYPE html>
<html lang="zh-CN">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<jsp:include page="header.jsp" />

<link href="css/home-style.css" rel="stylesheet" type="text/css" />
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.pagination.min.js"></script>
<style type="text/css">
.about-us-description{
	font-family: "Helvetica","Microsoft Yahei";
	font-size: 18px;
	line-height: 40px;
}
	.commets-box{
		margin-top: 20px;
		border-bottom: 1px dashed #cccccc;
		line-height: 30px;
	}

	.comments-cuser-info{
		margin-top: 2px;
		margin-left:auto;
		margin-right:2px;
		width:200px;
	}
	.comments-form{
		margin-top: 32px;
	}
.comments-form textarea{
	width: 1180px;
	height: 300px;
}
</style>
<body>
  <!--[if lt IE 9]>
  <link rel="stylesheet" type="text/css" href="css/custom-theme/jquery.ui.1.9.2.ie.css"/>
  <![endif]-->
<div class="container-fluid" style="width:1170px;margin:0 auto;">
<script type="text/javascript">
	var indexNum=6;
	

</script>
	<!--menu-->
	<jsp:include page="menu.jsp" ></jsp:include>
	<div class="row-fluid clearfix">
		<div id="comments_list_id">
			<div>no comments</div>
		</div>
		<div id="pager_id" class="pagination  pagination-right">
			<ul>
			</ul>
		</div>
		<div class="comments-form">
			<form action="/commitComments" method="post" id="ccommet_id">
				<textarea name="content" id="content_id" ></textarea>
				<input type="hidden" name="cuName" value="iiii"/>
				<input type="submit" value="提交"/>
				<%--<button type="button" value="提交" class="btn" onclick="s()">提交</button>--%>
			</form>
		</div>
	</div>
	<input type="hidden" id="tabs-id" value="${tabs}" />
	</div>
	

 <!--init for this page-->
		<script type="text/javascript" src="js/jquery-ui-1.9.2.custom.min.js"></script>
		<script type="text/javascript" src="js/SuperSlide.2.1.js"></script>
		<script type='text/javascript' src='js/jquery.browser.min.js'></script> 
		<script type='text/javascript' src='js/jquery.easing.1.3.js'></script> 
		 <script type="text/javascript" charset="utf-8" src="plugins/ueditor/ueditor.config.js"></script>
    	<script type="text/javascript" charset="utf-8" src="plugins/ueditor/ueditor.all.min.js"> </script>
    	<script type="text/javascript" charset="utf-8" src="plugins/ueditor/lang/zh-cn/zh-cn.js"></script>
		<script type="text/javascript" src="js/demo.js"></script>
		<jsp:include page="footer.jsp" />
</body>
 <script>
	
	$(document).ready(function(){
		getCommentsList(1);
	});
	var getCommentsList = function(page){
		var page_size=10;
		$.ajax({
			dataType: "json",
			type:"post",
			url: "ccomments",
			data: {pagesize:page_size,startNo:(page-1)*page_size},
			success:function(data){
				var resData = data.data;
				var html = "no comments";
				if(resData.length>0){
					html='';
					for(var i=0;i<resData.length;i++){
						html +='<div class="commets-box"><div>'
						+resData[i].content
						+'</div><div class="comments-cuser-info"><!--<span>'+resData[i].cusName
						+'</span><br/>--><span>'+resData[i].date+'</span></div></div>';
					}

				}
				$("#comments_list_id").html(html);
//				var con = {
//					'dom':$("#pager_id"),
//					'total':data.total,
//					'page_size':page_size,
//					'getListfun':getCommentsList(page)
//
//				}
//				pager(con);
				$("#pager_id").twbsPagination({
					totalPages:data.total,
					// startPage:'',
					visiblePages:page_size,
					// href :,
					// hrefVariable:'',
					first:'首页',
					prev:'上一页',
					next:'下一页',
					last:'尾页',
					onPageClick: function (event, page) {
						getCommentsList(page);
					}
				});
			}
		});
	}
	 var s = function(){
		 $.ajax({
			 dataType: "json",
			 type:"post",
			 url: "commitComments",
			 data: $("#ccommet_id").serialize(),
			 success:function(data){
				 console.log(data);
				 $("#content_id").val("");
				 cleaer();
				 not11();
			 }
		 });
	 }
	 var ue2 = UE.getEditor('content_id',{
		 toolbars: [[
			 'fullscreen',  '|',
			 'bold', 'italic', 'underline', 'fontborder', 'strikethrough',  'pasteplain', '|', 'forecolor', 'insertorderedlist', 'insertunorderedlist','|',
			 'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
			 'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
			 'directionalityltr', 'directionalityrtl', 'indent', '|',
			 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
			'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
			 'simpleupload', 'insertimage', 'emotion'
		 ]]
	 });
	 var cleaer = function(){
		 ue2.execCommand('cleardoc');
	 }

  </script>
</html>
